//和为s的两个数字
#include<iostream>
#include<vector>
using namespace std;


class Solution
{
public:
 vector<int> twoSum(vector<int>& nums, int target) 
 {
 int left = 0, right = nums.size() - 1;
 while(left < right)
 {
    int sum = nums[left] + nums[right];
    if(sum > target) right--;
    else if(sum < target) left++;
    else return {nums[left], nums[right]};
 }
 // 照顾编译器
 return {-1, -1};
 }
};